package com.zhz.mall.admin.modules.pms.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhz.mall.common.api.CommonPage;
import com.zhz.mall.common.api.CommonResult;
import com.zhz.mall.admin.modules.pms.model.PmsBrand;
import com.zhz.mall.admin.modules.pms.service.PmsBrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 品牌表 前端控制器
 * </p>
 *
 * @author zhouhengzhe
 * @since 2023-01-09
 */
@RestController
@RequestMapping("/brand")
public class PmsBrandController {
    @Autowired
    private PmsBrandService brandService;

    /**
     * 品牌数据列表
     * 在商品中进行共用
     * url:'/brand/list',
     * method:'get',
     * params:params
     */
    @GetMapping("/list")
    public CommonResult<CommonPage<PmsBrand>> list(
            @RequestParam(value = "keyword", defaultValue = "") String keyword,
            @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
            @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
        Page<PmsBrand> page = brandService.list(keyword, pageNum, pageSize);
        return CommonResult.success(CommonPage.restPage(page));
    }
}

